﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dokan;
using Microsoft.Win32;

namespace Organizer.Server
{
    class FileSystem : DokanOperations
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        private Dictionary<string, RegistryKey> TopDirectory;

        public FileSystem()
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            TopDirectory = new Dictionary<string, RegistryKey>();
            TopDirectory["ClassesRoot"] = Registry.ClassesRoot;
            TopDirectory["CurrentUser"] = Registry.CurrentUser;
            TopDirectory["CurrentConfig"] = Registry.CurrentConfig;
            TopDirectory["LocalMachine"] = Registry.LocalMachine;
            TopDirectory["Users"] = Registry.Users;
        }

        public int Cleanup(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int CloseFile(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int CreateDirectory(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int DeleteDirectory(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int DeleteFile(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int FindFiles(string filename, System.Collections.ArrayList files, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int FlushFileBuffers(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int GetDiskFreeSpace(ref ulong freeBytesAvailable, ref ulong totalBytes, ref ulong totalFreeBytes, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int GetFileInformation(string filename, FileInformation fileinfo, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int LockFile(string filename, long offset, long length, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int MoveFile(string filename, string newname, bool replace, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int OpenDirectory(string filename, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int ReadFile(string filename, byte[] buffer, ref uint readBytes, long offset, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int SetAllocationSize(string filename, long length, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int SetEndOfFile(string filename, long length, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int SetFileAttributes(string filename, System.IO.FileAttributes attr, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int SetFileTime(string filename, DateTime ctime, DateTime atime, DateTime mtime, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int UnlockFile(string filename, long offset, long length, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int Unmount(DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }

        public int WriteFile(string filename, byte[] buffer, ref uint writtenBytes, long offset, DokanFileInfo info)
        {
            log.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name + " called");

            throw new NotImplementedException();
        }
    }
}
